<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="keyword" content="">

    <title>任务列表-工程巡查管理</title>

    <!-- Bootstrap core CSS -->
    <link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet">
    <link href="__PUBLIC__/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="__PUBLIC__/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <!-- Custom styles for this template -->
    <link href="__PUBLIC__/css/style.css" rel="stylesheet">
    <link href="__PUBLIC__/css/style-responsive.css" rel="stylesheet" />
    <!-- new styles-->
      <link href="__PUBLIC__/css/xxxstyle.css" rel="stylesheet" />

      <link rel="stylesheet" type="text/css" href="__PUBLIC__/assets/bootstrap-datepicker/css/datepicker.css" />
      <link rel="stylesheet" type="text/css" href="__PUBLIC__/assets/bootstrap-datetimepicker/css/datetimepicker.css" />      
      <link rel="stylesheet" type="text/css" href="__PUBLIC__/assets/jquery-multi-select/css/multi-select.css" />
      <!--new dynamic table-->
      <link href="__PUBLIC__/assets/advanced-datatable/media/css/demo_page.css" rel="stylesheet" />
      <link href="__PUBLIC__/assets/advanced-datatable/media/css/demo_table.css" rel="stylesheet" />
      <link rel="stylesheet" href="__PUBLIC__/assets/data-tables/DT_bootstrap.css" />


      <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
      <script src="__PUBLIC__/js/html5shiv.js"></script>
      <script src="__PUBLIC__/js/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>

  <section id="container">
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper">
           <if condition="$_SESSION['role'] eq 1">
              <div class="row">
                  <div class="col-md-12">
                      <section class="panel">
                          <header class="panel-heading"><i class="icon-align-left"></i>项目状态统计
                                <span class="tools pull-right">
                                    <a href="javascript:;" class="icon-chevron-down"></a>
                                </span>
                          </header>
                          <div class="panel-body">
                              <ul class="ft-link">
                                  <div class="col-md-12 col-lg-6">
                                      <div class="row">
                                          <li><p>项目总数量</p><p>{$pcount.count}</p></li>
                                          <li><p>已完成项目</p><p>{$pcount.ok}</p></li>
                                          <li><p>未完成项目</p><p>{$pcount.no}</p></li>
                                          <li><p>延误项目</p><p>{$pcount.yw}</p></li>
                                      </div>
                                  </div>
                                  <div class="col-md-12 col-lg-6">
                                      <div class="row">
                                          <li><p>任务总数量</p><p>{$tcount.count}</p></li>
                                          <li><p>已完成任务</p><p>{$tcount.ok}</p></li>
                                          <li><p>未完成任务</p><p>{$tcount.no}</p></li>
                                          <li><p>延误任务</p><p>{$tcount.yw}</p></li>
                                      </div>
                                  </div>
                              </ul>
                          </div>
                      </section>
                  </div>
              </div>
              </if>
              <div class="row">
                  <div class="col-md-12">
                      <section class="panel">
                          <header class="panel-heading"><i class="icon-tags"></i>我的任务
                              <span class="tools pull-right">
                                  <a href="javascript:;" class="icon-chevron-down"></a>
                              </span>
                          </header>
                          <div class="panel-body">
                              <ul class="ft-link">
                                  <div class="col-md-12">
                                      <div class="row">
                                          <li><p>任务总数量</p><p>{$count['count']}</p></li>
                                          <li><p>已完成任务</p><p>{$count.ok}</p></li>
                                          <li><p>未完成任务</p><p class="text-warning">{$count.no}</p></li>
                                          <li><p>延误任务</p><p class="text-danger">{$count.yw}</p></li>
                                      </div>
                                  </div>
                              </ul>
                          </div>
                      </section>
                  </div>
              </div>
              <div class="row">
                  <div class="col-md-12">
                      <section class="panel">
                          <header class="panel-heading tab-bg-dark-navy-blue ">
                              <ul class="nav nav-tabs">
                                  <li class="active">
                                      <a data-toggle="tab" href="ltask-1" onclick="ajaxmtask(1)">指派给我的任务</a>
                                  </li>
                                  <li class="">
                                      <a data-toggle="tab" onclick="ajaxmtask(2)">我下达的任务</a>
                                  </li>
                                  <li class="">
                                      <a data-toggle="tab" onclick="ajaxmtask(3)">待我审核的任务</a>
                                  </li>
                                  <li class="">
                                      <a data-toggle="tab" onclick="ajaxmtask(5)">已完成的任务</a>
                                  </li>
                                  <li class="">
                                      <a data-toggle="tab" onclick="ajaxmtask(4)">我的所有任务</a>
                                  </li>
                              </ul>
                          </header>
                          <div class="panel-body">
                              <div class="tab-content">
                                  <div id="ltask-1" class="tab-pane active">
                                    
                                  </div>
                              </div>
                              <div class="task-log">
                                  <if condition="$_SESSION['pid'] neq ''"> 	
                                      <div class="adv-btn">                                                                                
                                          <button class="btn btn-submit" data-toggle="modal" href="#proModal2">下发任务</button>
                                      </div>
                                  </if>        
                                  <!-- Modal 下发任务 -->
                                  <div class="modal fade" id="proModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                      <div class="modal-dialog bigmodal">
                                          <div class="modal-content">
                                              <div class="modal-header">
                                                  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                                  <h4 class="modal-title">下发任务</h4>
                                              </div>
                                              <div class="modal-body">
                                                  <div class="form-group">
                                                      <label class="col-sm-15 control-label">任务名称</label>
                                                      <div class="col-sm-7-8">
                                                          <input type="text" class="form-control" value="" name="taskname">
                                                      </div>                                                                 
                                                  </div>
                                                  <div class="form-group">
                                                      <label class="col-sm-15 control-label">任务类型</label>
                                                      <div class="col-sm-45">
                                                          <select class="form-control" id="type">
                                                              <option value="1">普通任务</option>
                                                              <option value="2">里程碑任务</option>
                                                          </select>
                                                          <span class="caret"></span>
                                                      </div> 
                                                      <label class="col-sm-15 control-label">优先级</label>
                                                      <div class="col-sm-45">
                                                          <select class="form-control" id="priority">
                                                              <option value="1">普通</option>
                                                              <option value="2">紧急</option>
                                                          <!--     <option value="3">高</option>
                                                              <option value="4">紧急</option> -->
                                                          </select>
                                                          <span class="caret"></span>
                                                      </div>                                                             
                                                  </div>
                                                  <div class="form-group-nohidden">                                                                 
                                                      <label class="col-sm-15 control-label">执行人</label>
                                                      <div class="col-sm-45">
                                                          <select id="appoint" class="selectpicker" data-live-search="true">
                                                              <option value="0">请选择</option>  
                                                              <foreach name="user" item="v" key="k">
                                                                  <option value="{$v.admin_id}">{$v.name}</option>             
                                                              </foreach>
                                                          </select>
                                                      </div>
                                                      <label class="col-sm-15 control-label">审核人</label>
                                                      <div class="col-sm-45">
                                                          <select id="trial" class="selectpicker" data-live-search="true">
                                                              <option value="0">请选择</option>  
                                                              <foreach name="user" item="v" key="k">
                                                                  <option value="{$v.admin_id}">{$v.name}</option>             
                                                              </foreach>                       
                                                          </select>
                                                      </div>
                                                  </div>
                                                  <div class="form-group">                                                                 
                                                      <label class="col-sm-15 control-label">任务截止日期</label>
                                                      <div class="col-sm-45">
                                                          <div class="input-group date form_datetime-component">
                                                             <input type="text" class="form-control" readonly="" name="t_stop" value="" /> 
                                                            <!--   <input placeholder="请输入日期" class="form-control" onclick="laydate({istime: true,festival: true,issure: true,istoday: true, isclear: true, format: 'YYYY-MM-DD hh:mm:ss'})" name="t_stop" id="start"> -->
                                                             <!--   <input type="text" class="form-control" name="endtime" onfocus="MyCalendar.SetDate(this)"> -->
                                                              <span class="input-group-btn">
                                                                <button type="button" class="btn btn-calender date-set"><i class="icon-calendar"></i></button>
                                                              </span>
                                                          </div>
                                                      </div>
                                                  </div>
                                                  <div class="form-group">
                                                      <label class="col-sm-1-8 control-label">任务描述</label>
                                                      <div class="col-sm-7-8">
                                                          <textarea class="form-control error" id="mission-details" name="describe" rows="6" required=""></textarea>
                                                      </div>
                                                  </div>
                                              </div>
                                              <div class="modal-footer">
                                                  <button data-dismiss="modal" class="btn btn-default" type="button">取消</button>
                                                  <button class="btn btn-submit" type="button" onclick="xfa()">下发</button>
                                              </div>
                                          </div>
                                      </div>
                                  </div>           
                                  <!-- modal -->
                              </div>
                      </section>
                  </div>
              </div>
          </section>
      </section>
      <!--main content end-->
  </section>

   <!-- js placed at the end of the document so the pages load faster -->
    <script src="__PUBLIC__/js/jquery.js"></script>
    <script src="__PUBLIC__/js/jquery-1.8.3.min.js"></script>
    <script src="__PUBLIC__/js/bootstrap.min.js"></script>
     <script src="__PUBLIC__/js/jquery.scrollTo.min.js"></script>
    <script src="__PUBLIC__/js/jquery.nicescroll.js" type="text/javascript"></script>
    <script src="__PUBLIC__/js/jquery.customSelect.min.js" ></script>
    <!--common script for all pages-->
    <script src="__PUBLIC__/js/common-scripts.js"></script>
    <script src="__PUBLIC__/js/common-singlePage.js"></script>
    
      <!--new script for this page only-->
       <script src="__PUBLIC__/js/bootstrap-select.js"></script>
            <!--dynamic table initialization -->
      <script src="__PUBLIC__/js/jquery-migrate-1.2.1.min.js"></script>
      <script class="include" type="text/javascript" src="__PUBLIC__/js/jquery.dcjqaccordion.2.7.js"></script>
      <script type="text/javascript" language="javascript" src="__PUBLIC__/assets/advanced-datatable/media/js/jquery.dataTables.js"></script>
      <script type="text/javascript" src="__PUBLIC__/assets/data-tables/DT_bootstrap.js"></script>
      <script type="text/javascript" src="__PUBLIC__/assets/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
      <!-- <script type="text/javascript" src="__PUBLIC__/js/advanced-form-components.js"></script> -->

        <script type="text/javascript" src="__PUBLIC__/js/layer/layer.js"></script>

  <script>
      //custom select box
      $(function(){
          $('select.styled').customSelect();

          $(".form_datetime-component").datetimepicker({
              format: "yyyy-MM-dd  hh:ii",
              autoclose: true,
              todayBtn: true,
              pickerPosition: "bottom-left"
          });
      });
      
      $(document).ready(function(){
          ajaxmtask(1);
      });
      // ajax 抓取页面
      function ajaxmtask(sid=1){
              $.ajax({
                  type : "POST",
                  url:'__URL__/ajaxmtask',
                  data : {sid:sid},
                  success: function(res){
                	  if(res.status==0){
							layer.alert(res.info, {icon: 2});
							return;
					   }
                      $("#ltask-1").html('');
                      $("#ltask-1").append(res);
                  }
              });
      }
      
      //获取下发任务的指派人和审核人
/*       function xuser(){
    	  $.ajax({
		 		type : 'post',
		 		url : '__URL__/xuser',
		 		//data : {name:name,type:type,priority:priority,severity:severity,t_stop:t_stop,describe:describe},
		 		dataType : 'json',
		 		success : function(res){
		 			  if(res.status==0){
							layer.alert(res.info, {icon: 2});
							return;
					  }
		 			  if(!res.errNo){
		 				 // alert(res.msg.trial.name);
		 				  $('#appoint').attr('value',res.msg.appoint.name);
		 				  $('#appointid').attr('value',res.msg.appoint.admin_id);
		 				  $('#trial').attr('value',res.msg.trial.name);
		 				  $('#trialid').attr('value',res.msg.trial.admin_id);
		 				  $('#proModal2').modal('show');
			          }else{
			        	 layer.msg(res.msg,{icon:2});
			          }
		 		}
		     })
      } */
      
      //下发任务
      function xfa(){
    	  var name = $("input[name='taskname']").val();
    	  var type = $('#type option:selected').val();
    	  var priority = $('#priority option:selected').val();
    	  var severity = $('#severity option:selected').val();
    	  var t_stop = $("input[name='t_stop']").val();
    	  var describe = $("textarea[name='describe']").val();
    	  var appoint = $('#appoint option:selected').val();
    	  var trial = $('#trial option:selected').val();//任务完成提交给的审核人
    	  var assigname =  $('#appoint option:selected').text();//
    	 if(appoint==0){
    		 layer.msg('请选择执行人',{icon:2});
   		 	 return;
    	 }
    	 if(trial==0){
    		 layer.msg('请选择审核人',{icon:2});
   		 	 return;
    	 }
         if(name==''){
        	 layer.msg('任务名不能为空',{icon:2});
   		 	 return;
         }
         if(type==''){
        	 layer.msg('任务类型不能为空',{icon:2});
   		 	 return;
         }
         if(t_stop==''){
   		  layer.msg('任务日期不能为空',{icon:2});
   		  return;
   	     }
         if(describe==''){
        	 layer.msg('描述不能为空',{icon:2});
   		 	 return;
         }
    	 $.ajax({
		 		type : 'post',
		 		url : '__URL__/savetask',
		 		data : {name:name,type:type,priority:priority,severity:severity,t_stop:t_stop,describe:describe,assign:appoint,trial:trial,assigname:assigname},
		 		dataType : 'json',
		 		success : function(res){
		 			 if(res.status==0){
							layer.alert(res.info, {icon: 2});
							return;
				     }
		 			 if(!res.errNo){
		 				  layer.msg(res.msg,{icon:1});
		 				// setTimeout("location.reload()",2000);
		 				  $('#proModal2').modal('hide');
			         }else{
			        	 layer.msg(res.msg,{icon:2});
			         }
		 		}
		     })
      }
  </script>
  </body>
</html>
